package edu.jd.movieplatform.c_admin.feedback.impl;

import edu.jd.movieplatform.c_admin.feedback.FeedBackDto;
import edu.jd.movieplatform.c_admin.feedback.FeedBackService;
import edu.jd.movieplatform.c_admin.feedback.ReplyDto;
import edu.jd.movieplatform.c_admin.feedback.dao.FeedBackDao;
import edu.jd.movieplatform.common.Utils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Map;

@Service
@Transactional
public class FeedBackServiceImpl implements FeedBackService {
    @Resource
    private FeedBackDao feedBackDao;
    @Override
    public Map<String, Object> getFeedbackList(FeedBackDto dto) {
        return Utils.getPage(dto, () -> feedBackDao.getFeedbackList(dto));
    }

    @Override
    public void replyComment(ReplyDto dto) {
        dto.setReply_time(new Date());
        this.feedBackDao.insertCommentFeedback(dto);
    }

}
